import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:logger/logger.dart';
import 'package:colorize/colorize.dart';

class WebViewPage extends StatefulWidget {
  final String title;
  final num value;

  // 声明路由
  const WebViewPage({super.key, this.title = '页面', this.value = 0});

  // override 的作用是明确标识出一个方法是从父类或接口中继承并在子类中重写的。
  @override
  State<StatefulWidget> createState() {
    return _HomePageState();
  }
}

// 下划线代表私有
class _HomePageState extends State<WebViewPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text('${widget.title}')),
        // SafeArea 安全区域。一个确保内容不会被设备的刘海、圆角或其他屏幕特性遮挡的组件
        body: SafeArea(
          child: Container(
            padding: EdgeInsets.all(10),
            child: Column(children: [
              Text('body child 啊啊啊'),
              OutlinedButton(
                  onPressed: () {
                    Navigator.pop(context);
                    print('页面已经销毁了');
                    // var logger = Logger();
                    // logger.e("Logger is working!");
                  },
                  child: Text('页面销毁按钮'))
            ]),
          ),
        ));
  }
}
